package com.lt.route;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author lucine
 * @version 1.0 2021/6/20 15:06
 */
@Component
public class RouteCustomer {


    @RabbitListener(bindings = {
            @QueueBinding(
                    value = @Queue,
                    exchange = @Exchange(value="directs",type = "direct"),//自定义交换机名称、类型
                    key = {"info","warn","error"}
            )
    })
    public void  receive1(String message){
        System.out.println("RouteCustomer message1  = "+message);
    }

    @RabbitListener(bindings = {
            @QueueBinding(
                    value = @Queue,
                    exchange = @Exchange(value="directs",type = "direct"),//自定义交换机名称、类型
                    key = {"error"}
            )
    })
    public void  receive2(String message){
        System.out.println("RouteCustomer message2  = "+message);
    }
}
